package com.xfatm.util.redis;

import redis.clients.jedis.Jedis;

public class JedisExample {
    public static void main(String[] args){
        Jedis j=JedisUtils.getJedis();
        System.out.println(j.ping());
        System.out.println(j.get("aa"));
        j.close();
        j=JedisUtils.getJedis();
        System.out.println(j.lrange("logstash2",0,1));
        while (true){
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            try {
                j=JedisUtils.getJedis();
                if(j!=null){
                    System.out.println(j.ping());
                }
            }catch (Exception e){
                System.out.println("no pong");
            }
        }
    }
}
